<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>一生平安-个人中心</title>
<link rel="stylesheet" type="text/css" href="${ctx}/lib/mobile/jquery_mobile_1.0b1/jquery.mobile-1.0b1.min.css" />
	<link rel="stylesheet" type="text/css" href="${ctx}/lib/mobile/css/jszx-scroll.css" />
	<link rel="stylesheet" type="text/css" href="${ctx}/lib/mobile/css/jszx-bar.css" />
	<link rel="stylesheet" type="text/css" href="${ctx}/lib/mobile/css/dynamicPic.css" />
	<link rel="stylesheet" type="text/css" href="${ctx}/lib/mobile/css/mobile.css" />
	<link type="text/css" href="${ctx}/lib/mobile/jquery_mobile_1.0b1/jquery.mobile.datebox.min.css" rel="stylesheet" />
	<script type="text/javascript" src="${ctx}/lib/mobile/jquery_mobile_1.0b1/jquery-1.6.4.min.js"></script>
	<script>
	$(document).bind("mobileinit", function(){
		$.mobile.loadingMessage=false;
		$.mobile.selectmenu.prototype.options.nativeMenu = false;
		$.mobile.defaultPageTransition="none";
		$.mobile.listview.prototype.options.filterPlaceholder="";
	});
	</script>
	<script type="text/javascript" src="${ctx}/lib/mobile/jquery_mobile_1.0b1/jquery.mobile-1.0b1.min.js" charset="utf-8"></script>
	<script type="text/javascript" src="${ctx}/lib/mobile/js/mobile-common.js" charset="utf-8"></script>
	<script type="text/javascript" src="${ctx}/lib/mobile/js/dynamicPic.js" charset="utf-8"></script>
	<script type="text/javascript" src="${ctx}/lib/mobile/js/mobile.js" charset="utf-8"></script>
	<script type="text/javascript" src="${ctx}/lib/mobile/jquery_mobile_1.0b1/jquery.mobile.datebox.js"></script>
	<script type="text/javascript" src="${ctx}/lib/mobile/jquery_mobile_1.0b1/jquery.mobile.datebox.i8n.CHN-S.utf8.js"></script>
</head>
<body>
	<div data-role="page" id="mobile-userCenter-page" class="page-div-style">
		<script>
		$('#mobile-userCenter-page').live('pagebeforeshow',function(){
			//显示头部栏
	 		initHeader($("#mobileUserCenterHeader"),"back");
	 		$("#mobileUserCenterHeader").find("[name='mobileHeaderTitle']").text("个人中心");
	 		
	 		var u = navigator.userAgent;
			if(u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) != null){
				window.mobileSystem = "ios";
			}
			if(u.indexOf('Android') > -1 || u.indexOf('Linux') > -1){
				window.mobileSystem = "android";
			}
		});
		
		$("#mobile-userCenter-page").live("pageshow",function(){
			$("#mobileUserCenterScroller").css("height",window.innerHeight - $("#mobileUserCenterHeader").height());
		});
		
		//显示个人信息
		function showLogin(){
			//当前登录用户
			window.location.href = "${ctx}/mobile/toUserSet.html";
		}
		
		//显示IMIE
		function toUserIMEI(){
			//当前IMIE
			window.location.href = "${ctx}/mobile/toUserIMEI.html";
		}
		
		//修改密码
		function changePwd(){
			window.location.href = "${ctx}/mobile/toPwdChange.html";
		}
		
		//退出账号
		function doLogout(){
			// 注册通知
			if(window.mobileSystem === "ios"){
				var cmd = "delchanleid";
				var str = "${user.userno}";
		 		window.location.href = "objc://" + cmd + ":/" + str;
			} else if(window.mobileSystem === "android"){
				if(typeof(window.myjs) != "undefined"){
					window.myjs.delchanleid("${user.userno}");
				}
			}
			window.localStorage.removeItem("userno_time");
			window.localStorage.removeItem("userno");
			window.location.href = "${ctx}/mobile/logout.html";
		}
		
		function getversion(version){
			getAndroid(version,"versionIOS");
		}
		
		function getAndroid(curVersion,version){
			var date = new Date();
			$.ajax({
	            url: "http://222.174.4.86:8080/version/" + version + ".txt?time=" + date.getTime(),
	            async: true,
	            data:{},
	            type:"GET",
	           	dataType:"text",
	         	success:function(data){
	         		if(("" + curVersion) < data){
	         			if(window.mobileSystem === "ios"){
	         				indexObj.showMsgDialog("0","发现新版本，请更新！");
	         			} else {
		         			indexObj.showMsgDialog("1","发现新版本，请更新！",function(){
		        				window.myjs.downapp("http://222.174.4.86:8080/version/yspa" + data + ".apk");
		        			});
	         			}
	         		} else {
	         			indexObj.showMsgDialog("0","当前最新版本！");
	         		}
	       		},error:function(){
	       			indexObj.showMsgDialog("0","当前版本:" + curVersion);
	       		}
		    });
		}
		//检查更新
		function checkVersion(){
			var curVersion;
			if(window.mobileSystem === "ios"){
		 		window.location.href = "objc://getversion:/";
			} else if(window.mobileSystem === "android"){
				if(typeof(window.myjs) != "undefined"){
					curVersion = window.myjs.getversion();
				}
				getAndroid(curVersion,"version");
			}
			
		}
		
		var userCenter = new Object();
		
		</script>
		<input type="hidden" id="version" value="${verion}">
		<div id="indexMsg" style="display: none;">
			<div style="position:absolute;width:100%;height:100%;top:0;z-index:50;opacity: 0.5;background-color: black;">
			</div>
			<div style="position:absolute;width:100%;height:100%;top:0;z-index:100;" id="index_showBox">
				<div class="msgbox">
					<div class="tips">提示</div>
					<div class="btnarea">
					</div>
					<div class="btn">
						<div class="div_login" align="center" id="index_showBtn" onclick="indexObj.hideMsgDialog()">
							<div>确定</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div align="center" data-role="header" data-theme="b"  data-position="" id="mobileUserCenterHeader">
		</div>
		<div data-role="" id="mobileUserCenterWrapper" style="padding:0;margin: 0px;" class="jszx-wrapper">
			<div id="mobileUserCenterScroller" class="jszx-scroller" style="background: url(${ctx}/lib/mobile/image/center-bg.png) no-repeat;
				background-size: cover;">
				<div class="ui-grid-a ui-grid-jkrj-a" style="">
					<div class="ui-block-a ui-block-text" onclick="showLogin()">
						<div>
							<div class="ui-menu-background" style="background: url(${ctx}/lib/mobile/image/showLogin.png) no-repeat;
								background-size: contain;background-position: 50%;"></div>
							<div class="ui-menu-text">个人信息</div>
						</div>
					</div>
					<div class="ui-block-b ui-block-text" onclick="toUserIMEI()">
						<div>
							<div class="ui-menu-background"  style="background: url(${ctx}/lib/mobile/image/toUserIMEI.png) no-repeat;	
								background-size: contain;background-position: 50%;"></div>
							<div class="ui-menu-text">IMEI账号</div>
						</div>
					</div>
					<div class="ui-block-a ui-block-text" onclick="changePwd()">
						<div>
							<div class="ui-menu-background"  style="background: url(${ctx}/lib/mobile/image/changePwd.png) no-repeat;	
								background-size: contain;background-position: 50%;"></div>
							<div class="ui-menu-text">密码修改</div>
						</div>
					</div>
					<div class="ui-block-b ui-block-text" onclick="doLogout()">
						<div>
							<div class="ui-menu-background"  style="background: url(${ctx}/lib/mobile/image/doLogout.png) no-repeat;	
								background-size: contain;background-position: 50%;"></div>
							<div class="ui-menu-text">退出登录</div>
						</div>
					</div>
					<div class="ui-block-a ui-block-text" onclick="checkVersion()">
						<div>
							<div class="ui-menu-background"  style="background: url(${ctx}/lib/mobile/image/checkVersion.png) no-repeat;	
								background-size: contain;background-position: 50%;"></div>
							<div class="ui-menu-text">检查更新</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>